<template>
	<div class="cominglist">
		<div>
			<p class="group-date" v-if="coming!=null">更多待映</p>
			<router-link class="item" v-for="item in coming" :key="item.id" :to="`/moviepage/${item.id}`">
				<div class="main-block">
					<div class="avatar">
						<div class="default-img-bg">
							<img :src="$options.filters.src(item.img)">
						</div>
					</div>

					<div class="content-wrapper mb-outline-b">
						<div class="content">
							<div class="movie-title">
								<div class="title line-ellipsis">{{item.nm}}</div>
							</div>

							<div class="detail">
								<div class="wantsee line-ellipsis">
									<span class="person">{{item.wish}}</span>
									<span class="p-suffix">人想看</span>
								</div>

								<div class="actor line-ellipsis">主演:{{item.star}}</div>

								<div class="actor line-ellipsis">{{item.rt}}</div>
							</div>
						</div>

						<router-link class="button-block" tag="div" :to="`/buyinfo/${item.id}`">
							<div class="btn" style="background-color: #3c9fe6;">
								<span class="fix">预售</span>
							</div>
						</router-link>
					</div>


				</div>
			</router-link>
		</div>


	</div>
</template>

<script>
	export default {
		data() {
			return {
				coming: null,
				limit: 12
			}
		},
		created() {
			this.getComing()
		},
		methods: {
			async getComing() {
				let re = await this.$axios.get('https://apis.netstart.cn/maoyan/index/comingList?ci=20&limit=' + this
					.limit)
				// console.log(re)
				this.coming = re.coming
			},
		},
		filters: {
			src(value) {
				return value.replace('/w', '/' + 60).replace('.h', '.' + 90)
			}
		},
	}
</script>

<style scoped lang="less">
	.cominglist {
		background-color: #fff;

		.group-date {
			padding: 12px 15px 0;
			margin: 0;
			font-size: 14px;
			color: #333;
		}
	}

	.item {
		padding-left: 15px;
		background-color: #fff;

		.main-block {
			position: relative;
			width: 100%;
		}

		.avatar {
			width: 64px;
			height: 95px;
			position: relative;
			margin-top: 12px;
			float: left;

			&::before {
				content: "";
				display: block;
				position: absolute;
				width: 46px;
				height: 46px;
				background-repeat: no-repeat;
				background-size: contain;
			}

			img {
				background-color: transparent;
				height: 90px;
			}
		}

		.content-wrapper {
			padding: 12px 14px 12px 0;
			margin-left: 74px;
			height: 90px;
			max-height: 90px;
			position: relative;
		}

		.content {
			padding-right: 5px;
			margin-right: 48px;
			overflow: hidden;
		}

		.movie-title {
			max-height: 24px;
			margin-bottom: 7px;
			line-height: 24px;
			overflow: hidden;
			display: flex;
		}

		.title {
			font-size: 17px;
			color: #333;
			font-weight: 700;
			padding-right: 5px;
			flex-shrink: 1;
		}

		.detail {
			box-sizing: border-box;
			line-height: 1;
			overflow: hidden;

			.wantsee .person {
				color: #faaf00;
				font-size: 15px;
				font-weight: 600;
			}

			.wantsee .p-suffix {
				font-size: 13px;
				margin-left: -2px;
				display: inline-block;
				color: #666;
			}

			&>div+div {
				margin-top: 6px;
				line-height: 15px;
			}

			.actor {
				font-size: 13px;
				color: #666;
			}
		}

		.button-block {
			font-size: 12px;
			position: absolute;
			right: 14px;
			top: 0;
			bottom: 0;
			height: 27px;
			margin: auto;

			.btn {
				width: 54px;
				height: 28px;
				display: flex;
				justify-content: center;
				align-items: center;
				box-sizing: border-box;
				background-color: #f03d37;
				color: #fff;
				white-space: nowrap;
				font-size: 13px;
				font-weight: 500;
				cursor: pointer;
				border-radius: 13.5px;
			}
		}
	}

	.default-img-bg {
		background-color: #e1e1e1;
		background-size: 100% 100%;
	}

	.mb-outline-b {
		background: url(../assets/img/repeat-x-bottom-outline.png) 0 bottom repeat-x;
		background-size: 1px 1px;
	}

	.line-ellipsis {
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;
	}
</style>
